home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Shutdown FX 1.3 Source / Shutdown FX ƒ / sfx wipes ƒ / SlideWipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  2.4 KB  |  85 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        SlideWipe.c
  4.  
  5. Purpose:    This module handles clearing the screen in a funky
  6.             manner.  See the comments below for more details.
  7.             
  8.  
  9. Shutdown FX -=- graphic effects on shutdown
  10. Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define        BoxSize        20
  32. #define        StripSize    40
  33. #define CorrectTime 1
  34.  
  35. void SlideWipe(GrafPtr thePtr, Pattern *thePattern, int width, int height);
  36.  
  37. /* cut the screen into strips of size StripSize and scroll each strip either
  38.    left or right, successively. */
  39.  
  40. void SlideWipe(GrafPtr thePtr, Pattern *thePattern, int width, int height)
  41. {
  42.     int            x, y;
  43.     Rect        dest;
  44.     Rect        scrollsource, scrolldest;
  45.     int            direction;
  46.     
  47.     direction = 0;
  48.     
  49.     for(y = 0; y < height; y += StripSize)
  50.     {
  51.         SetRect(&scrollsource, 0, y, width, y+StripSize);
  52.         scrolldest = scrollsource;
  53.         SetRect(&dest, 0, y, width, y+StripSize);
  54.         
  55.         if(direction == 0)
  56.         {
  57.             OffsetRect(&scrolldest, BoxSize, 0);
  58.             dest.right = dest.left + BoxSize;
  59.             for(x = width - BoxSize; x >= 0; x -= BoxSize)
  60.             {
  61.                 StartTiming();
  62.                 CopyBits(&(thePtr->portBits), &(thePtr->portBits),
  63.                         &scrollsource, &scrolldest, 0, 0L);
  64.                 FillRect(&dest, *thePattern);
  65.                 TimeCorrection(CorrectTime);
  66.             }
  67.         }
  68.         else
  69.         {
  70.             OffsetRect(&scrolldest, -BoxSize, 0);
  71.             dest.left = dest.right - BoxSize;
  72.             for(x = BoxSize; x <= width; x += BoxSize)
  73.             {
  74.                 StartTiming();
  75.                 CopyBits(&(thePtr->portBits), &(thePtr->portBits),
  76.                         &scrollsource, &scrolldest, 0, 0L);
  77.                 FillRect(&dest, *thePattern);
  78.                 TimeCorrection(CorrectTime);
  79.             }
  80.         }
  81.         
  82.         direction = 1 - direction;
  83.     }
  84. }
  85.